<div class="row">
  <div class="col-md-3 wh-sidebar">
    {{#search/filter-rail header=header as |rail|}}

      {{#search/containers/search-sources currentSource=source as |searchSource|}}
        {{rail.radioGroup
          radioOptions=searchSource.radioSources
          title="Source"
          changed=(action "sourceDidChange")}}
      {{/search/containers/search-sources}}

    {{!--Api for date range not currently available--}}
    {{!--rail.dateRange
      startDateChanged=(action 'startDateDidChange')
      endDateChanged=(action 'endDateDidChange')--}}
    {{/search/filter-rail}}
  </div>
  <div class="col-md-9 wh-main-content">
    <section class="search-results page-section-container">
      {{#if model.count}}
        <div class="search-pagination">
          <ul class="pager">
            {{#unless first}}
              <li class="previous">
                {{#link-to 'search'
                           (query-params categroy=category source=source page=previousPage)}}
                  &larr; Prev
                {{/link-to}}
              </li>
            {{/unless}}
            <li>
              {{ model.count }} results - page {{ model.page }}
              of {{ model.totalPages }}
            </li>
            {{#unless last}}
              <li class="next">
                {{#link-to 'search'
                           (query-params categroy=category source=source page=nextPage)}}
                  Next &rarr;
                {{/link-to}}
              </li>
            {{/unless}}
          </ul>
        </div>
      {{/if}}
      {{#if model.count}}
        {{#if model.isFlowJob}}
          <table id="searchresults" class="search-results searchtable">
            <tbody>
            {{#each model.data as |flowJob|}}
              <tr class="result">
                <td class="col-xs-12">
                  <div class="dataset-info">
                    <i class="fa fa-random"></i>
                    <a href="{{flowJob.link}}">
                      {{flowJob.displayName}}
                    </a>
                  </div>
                  <p>{{ flowJob.path }}</p>
                  <p>source: {{ flowJob.appCode }}</p>
                  <div class="schematext"
                       style="margin-top:5px;margin-bottom: 10px;">
                    {{ flowJob.schema }}
                  </div>
                </td>
              </tr>
            {{/each}}
            </tbody>
          </table>
        {{else}}
          <table id="searchresults" class="search-results searchtable">
            <tbody>
            {{#each model.data as |dataset|}}
              <tr class="result">
                <td class="col-xs-12">
                  <div class="dataset-info">
                    {{#if model.isMetrics}}
                      <i class="fa fa-plus-square-o"></i>
                      {{#link-to 'metrics.metric' dataset.id}}
                        {{dataset.name}}
                      {{/link-to}}
                    {{else}}
                      <i class="fa fa-database"></i>
                      {{#link-to 'datasets.dataset' dataset.id}}
                        {{dataset.name}}
                      {{/link-to}}
                    {{/if}}
                  </div>
                  <p>
                    {{ dataset.urn }}
                  </p>
                  {{#if dataset.source}}
                    <p>source: {{ dataset.source }}</p>
                  {{else}}
                    <p>source: Metric</p>
                  {{/if}}
                  <div class="schematext"
                       style="margin-top:5px;margin-bottom: 10px;">
                    {{ dataset.schema }}
                  </div>
                </td>
              </tr>
            {{/each}}
            </tbody>
          </table>
        {{/if}}
      {{else}}
        {{#if showNoResult}}
          <h4>No items found</h4>
        {{/if}}
      {{/if}}
    </section>
  </div>
</div>
